import java.awt.*;
import java.awt.event.*;
import java.util.*;

import javax.swing.JList;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import com.sun.java.swing.*;

//this is a simple adapter class to
//convert List awt methods to Swing methods
/**
 * adaptor ce converteste metodele awt in metode Swing
 */
public class JclassAwtList extends JList   implements ListSelectionListener, awtList
{
   private JListData listContents;
//-----------------------------------------
   public JclassAwtList(int rows)
   {
      listContents = new JListData();
      setModel(listContents);
      setPrototypeCellValue("Abcdefg Hijkmnop");     
   }
//-----------------------------------------
   public void add(String s)
   {
      listContents.addElement(s);
   }
//-----------------------------------------
   public void remove(String s)
   {
      listContents.removeElement(s);
   }
//-----------------------------------------
   public String[] getSelectedItems()
   {
      Object[] obj = getSelectedValues();
      String[] s = new String[obj.length];
      for (int i =0; i<obj.length; i++) 
            s[i] = obj[i].toString();
      return s;
   }
//-----------------------------------------
   public void valueChanged(ListSelectionEvent e)
   {
   }
   
}
